/**
 * A Building figure. extends figure.
 * This class represent any Building figure.
 * every building figure in the game will extend this class.
 * @authors Itay Sorani, Nadav Ziv, Yonathan Zarsky
 */
package com.example.models;

import android.content.Context;

import com.example.util.Figure;
import com.example.util.FigureType;

public class Building extends Figure {
	
	// the building production rate
	private int productionRate;
	// counts time till next unit production
	private int timeTillNextProduction;
	// the building cost
	private int cost;
	//the building final destination, every unit that created from this building will go to that building
	private Building finalDestination;
	//building id
	private int buildingId;
	// the building name (for renderer)
	private String name = "DeafultBuildingName";
	
	/**
     * Constructs a new building according to productionRate, and the figure type.
     */
	public Building(Context context) {
		super(context);
		timeTillNextProduction = productionRate;
		setFigureType(FigureType.building);
	}
	
	/**
     * Constructs a new building according to productionRate, and the figure type.
     */
	public Building() {
		super();
		setFigureType(FigureType.building);
	}
	
	/**
     * updates the production rate
     */
	public void updateProductionRate () {
		if (timeTillNextProduction <= 0){
			timeTillNextProduction = productionRate;
		} else {
			timeTillNextProduction--;
		}
	}
	
	/**
     * sets the final destination
     */
	public void setFinalDestination(Building finalDestination) {
		this.finalDestination = finalDestination;
	}

	/**
     * returns the final destination
     */
	public Building getFinalDestination() {
		return finalDestination;
	}

	/**
     * sets the building id
     */
	public void setBuildingId(int buildingId) {
		this.buildingId = buildingId;
	}

	/**
     * returns the building id
     */
	public int getBuildingId() {
		return buildingId;
	}
	
	/**
     * sets the building production rate
     */
	public void setProductionRate(int productionRate) {
		this.productionRate = productionRate;
	}
	
	/**
     * returns the building production rate
     */
	public int getProductionRate() {
		return (this.productionRate);
	}
	
	/**
     * returns time left for next production
     */
	public int getTimeTillNextProduction() {
		return (this.timeTillNextProduction);
	}

	/**
     * sets the building name
     */
	public void setName(String name) {
		this.name = name;
	}

	/**
     * returns the building name
     */
	public String getName() {
		return name;
	}

	/**
     * sets the building cost
     */
	public void setCost(int cost) {
		this.cost = cost;
	}

	/**
     * returns the building cost
     */
	public int getCost() {
		return cost;
	}
}
